require("../../assets/css/normalize.css");
require("../../assets/css/reset.css");
require("../../assets/fonts/iconfont.css");
require("../../assets/css/tabbar.less");
require("../../assets/css/navbar.less");
require("./sports_ride.less");
const dom = require("../../utils/dom.js");
const axios = require("axios");
document.addEventListener("DOMContentLoaded", function () {
	//头部和底部导航栏
	dom.tabbar("sport");
	dom.navbar("ride");

	//点击显示蒙层
	dom.get(".btn").addEventListener("click", function () {
		dom.get(".box").style.display = "block";
		dom.get(".box2").style.display = "block";
		let n = 3;
		setInterval(function () {
			n--;
			dom.get(".box2").textContent = n;
			if (n === 0) {
				location.href = "sports_rideing.html";
			}
		}, 1000);
	});
	let token = localStorage.getItem("token");
	axios.defaults.headers.common["Authorization"] = "Bearer " + token;
	axios.get("http://fitness.h5.itsource.cn:3701/api/exercise").then((res) => {
		dom.get("#meter").textContent = res.data.data.sum7Meter / 1000;
	});
});
